<template>
	<view class="main">
		<u-navbar :is-back="true" title="我的转增" :background="background" :border-bottom="false" title-color="#fff"
			title-size="35rpx" title-bold="true" back-icon-color="#fff">
			<view class="record" slot="right" @click="router">
				转赠记录
			</view>
		</u-navbar>
		<view class="address">
			<view class="phone">
				<label>对方手机号</label><input type="number" value="" v-model="phone" placeholder="请输入对方手机号" />
			</view>
			<view class="youraddress">
				<view class="address_tit">
					对方合约地址
				</view>
				<input type="text" value="" v-model="address" placeholder="请输入对方合约地址" />
			</view>
		</view>
		<view class="shop">
			<view class="shops_tit" @click="show=true">
				<view class="selects">
					选择转增的藏品
				</view>
				<image src="../../../static/images/goright.png" mode=""></image>
			</view>
			<view class="shop_content">
				<view class="left">
					<image :src="info.img" mode=""></image>
				</view>
				<view class="right">
					<view class="shop_tit">
						{{info.title==undefinde?'':info.title}}
					</view>
					<view class="company">
						<image :src="info.issuer_img" mode=""></image>
						<text>{{info.issuer_name}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="pro_money">
			<text class="pro_tit">转增手续费</text>
			<text>￥{{fee}}</text>
		</view>
		<view class="payment">
			<view class="pay_tit">
				支付方式
			</view>
			<view class="where" v-for="item,index in which" :key="index">
				<view class="give">
					<image :src="item.image" mode=""></image>
					<text>{{item.title}}</text>
				</view>
				<image @click="choses(item.id)" class="chose"
					:src="item.id==where?'../../../static/images/chosed.png':'../../../static/images/chose.png'"
					mode=""></image>
			</view>
		</view>
		<view class="buy">
			<view class="money">
				<text>￥</text>6.00
			</view>
			<view class="button" @click="sub(info.id)">
				<text>立即支付</text>

			</view>
		</view>
		<u-popup v-model="show" mode="bottom" border-radius="14" duration="200">
			<scroll-view scroll-y="true" style="height: 900rpx;">
				<view class="shop" style="margin: 20rpx auto; " v-for="item,index in shop" :key="index" @click="chosed(index)">
					<view class="shop_content">
						<view class="left">
							<image :src="item.img" mode=""></image>
						</view>
						<view class="right">
							<view class="shop_tit">
								{{item.title}}
							</view>
							<view class="company">
								<image :src="item.issuer_img" mode=""></image>
								<text>{{item.issuer_name}}</text>
							</view>
						</view>
					</view>

				</view>
			</scroll-view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				background: {
					backgroundColor: '#111111',
					// background: 'url(https://cdn.uviewui.com/uview/swiper/1.jpg) no-repeat',
				},
				show: false,
				fee: '',
				where: 1,
				phone: '',
				address: '',
				which: [{
						id: 1,
						image: '../../../static/images/wx.png',
						title: '微信支付',
						flag: false,
					},
					{
						id: 2,
						image: '../../../static/images/zfb.png',
						title: '支付宝支付',
						flag: true,
					},
					{
						id: 3,
						image: '../../../static/images/ys.png',
						title: '云闪付支付',
						flag: true,
					},
				],
				shop:[],
				info:{},
			}
		},
		onLoad() {
			this.getmoney()
			this.getinfo()
		},
		methods: {
			sub(id) {
				global.$http.request({
					url: '/api/transfer/transfer',
					data: {
						token: uni.getStorageSync('token'),
						phone: this.phone,
						address: this.address,
						pay_type: this.where,
						goods_id: id
					}
				})
			},
			choses(e) {
				console.log(e);
				this.where = e
				// this.which[e].flag=!this.which[e].flag
			},
			changehead() {
				this.show = !this.show
			},
			close() {
				this.show = !this.show
			},
			router(){
				uni.navigateTo({
					url:'../pass_record/pass_record'
				})
			},
			chosed(index){
			this.info=this.shop[index]
			this.show=false
			},
			getmoney() {
				global.$http.request({
					url: '/api/transfer/getTransferFee',
					data: {
						token: uni.getStorageSync('token')
					}
				}).then(res => {
					if (res.data.code == 0) {
						console.log(res.data.data);
						this.fee = res.data.data.fee
					}
				})
			},
			getinfo(){
				global.$http.request({
					url:'/api/home/goodsList',
					data:{
						limit:10,
						page:1,
						category:1,
					}
				}).then(res=>{
					if(res.data.code==0){
						console.log(res.data.data.list);
						this.shop=res.data.data.list
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		font-family: PingFang SC-Regular, PingFang SC;
		background-color: #111111;
		width: 750rpx;

		.main {
			margin-top: 24rpx;
			display: flex;
			flex-direction: column;
			align-items: center;

			.record {
				font-size: 32rpx;
				font-weight: 400;
				color: #FFFFFF;

			}

			.address {
				padding: 32rpx 24rpx;
				width: 686rpx;
				background: #181818;
				border-radius: 32rpx;
				opacity: 1;

				.phone {
					// font-size: 32px;
					font-weight: 400;
					padding: 0 0 36rpx 0;
					border-bottom: 2rpx solid #262626;

					label {
						font-size: 32rpx;
						font-weight: 400;
						color: #FFFFFF;
					}

					input {
						font-size: 32rpx;
						text-align: right;
						opacity: 1;
						color: #FFFFFF;
						opacity: 0.8;
					}

					display:flex;
					justify-content: space-between;
				}

				.youraddress {
					.address_tit {
						padding: 36rpx 0;
						font-size: 32rpx;
						font-weight: 400;
						color: #FFFFFF;
					}

					input {
						font-size: 32rpx;
						font-weight: 400;
						color: #FFFFFF;
						opacity: 0.8;
					}
				}
			}

			.pro_money {
				margin: 24rpx 0;
				width: 686rpx;
				height: 92rpx;
				background: #181818;
				border-radius: 32rpx;
				opacity: 1;
				font-size: 28rpx;
				font-weight: 400;
				color: #FFFFFF;
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 24rpx;

				text {

					display: block;
				}

				.pro_tit {
					font-size: 32rpx;
					font-weight: 400;
					color: #FFFFFF;

				}
			}

			.shop {
				.shops_tit {
					display: flex;
					justify-content: space-between;
					align-items: center;
					padding-bottom: 24rpx;

					.selects {
						font-size: 32rpx;
						font-weight: 400;
						color: #FFFFFF;
					}

					image {
						width: 24rpx;
						height: 24rpx;
					}
				}

				.shop_content {
					display: flex;
				}

				margin: 24rpx 0;
				width: 686rpx;
				background: #181818;
				border-radius: 32rpx;
				opacity: 1;

				padding: 24rpx;

				.left {
					width: 200rpx;
					border-radius: 32rpx;
					overflow: hidden;
					height: 200rpx;

					image {
						width: 200rpx;
						height: 200rpx;
					}
				}

				.right {
					padding-left: 24rpx;

					.shop_tit {

						font-size: 32rpx;
						font-weight: bold;
						color: #FFFFFF;
					}

					.company {
						display: flex;
						align-items: center;
						font-size: 24rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #FFFFFF;
						opacity: 0.5;
						padding: 16rpx 0 60rpx 0;

						image {
							width: 36rpx;
							height: 36rpx;
							margin-right: 16rpx;
						}
					}


				}
			}



			.payment {
				margin-bottom: 130rpx;
				width: 686rpx;
				background: #181818;
				border-radius: 32rpx;
				opacity: 1;
				padding: 24rpx;

				.pay_tit {
					padding: 32rpx 0;
					font-size: 32rpx;
					font-weight: 400;
					color: #FFFFFF;
				}

				.where {
					display: flex;
					align-items: center;
					justify-content: space-between;
					// padding: 0 24rpx 32rpx 24rpx;
					padding-bottom: 32rpx;

					.give {
						display: flex;
						align-items: center;

						image {
							width: 48rpx;
							height: 48rpx;
							margin-right: 16rpx;
						}

						font-size: 28rpx;
						font-weight: 400;
						color: #FFFFFF;
					}

					.chose {
						width: 36rpx;
						height: 36rpx;
					}
				}
			}

			.buy {
				position: fixed;
				bottom: 0;
				width: 750rpx;
				background: #151515;
				box-shadow: 0rpx -1rpx 0rpx 2rpx rgba(0, 0, 0, 0.07);
				border-radius: 0rpx 0rpx 0rpx 0rpx;
				opacity: 1;
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 10rpx 32rpx;

				.money {
					font-size: 48rpx;
					font-weight: 400;
					color: #FFFFFF;

					text {
						padding-right: 4rpx;
						font-size: 32rpx;
						font-weight: 400;
						color: #FFFFFF;

					}

				}

				.button {
					padding: 16rpx 40rpx;
					background: #F3C860;
					border-radius: 42rpx 42rpx 42rpx 42rpx;
					opacity: 1;
					text-align: center;
					font-size: 32rpx;
					font-weight: bold;
				}
			}
		}
	}
</style>
